package com.aspose.cells;

public class BorderCollection {
   boolean a;
   private Style b;
   private Border[] c;

   BorderCollection(Style style) {
      this.b = style;
      this.c = new Border[8];

      for(int var2 = 0; var2 < 6; ++var2) {
         Border var3 = new Border(this);
         switch(var2) {
         case 0:
            var3.a(8);
            break;
         case 1:
            var3.a(16);
            break;
         case 2:
            var3.a(32);
            break;
         case 3:
            var3.a(1);
            break;
         case 4:
            var3.a(2);
            break;
         case 5:
            var3.a(4);
         }

         this.c[var2] = var3;
      }

   }

   Style a() {
      return this.b;
   }

   Border b() {
      return this.c[6];
   }

   void a(Border var1) {
      this.c[6] = var1;
   }

   Border c() {
      return this.c[7];
   }

   void b(Border var1) {
      this.c[7] = var1;
   }

   public Border getByBorderType(int borderType) {
      switch(borderType) {
      case 1:
         return this.c[3];
      case 2:
         return this.c[4];
      case 4:
         return this.c[5];
      case 8:
         return this.c[0];
      case 16:
         return this.c[1];
      case 32:
         return this.c[2];
      case 64:
         if (this.c[7] == null) {
            this.c[7] = new Border(this, 64);
         }

         return this.c[7];
      case 128:
         if (this.c[6] == null) {
            this.c[6] = new Border(this, 128);
         }

         return this.c[6];
      default:
         return null;
      }
   }

   boolean d() {
      return this.c[0].getLineStyle() != 0 || this.c[1].getLineStyle() != 0 || this.c[2].getLineStyle() != 0 || this.c[3].getLineStyle() != 0 || this.c[4].getLineStyle() != 0 || this.c[5].getLineStyle() != 0 || this.c[6] != null && this.c[6].getLineStyle() != 0 || this.c[7] != null && this.c[7].getLineStyle() != 0;
   }

   boolean a(BorderCollection var1, Workbook var2, Workbook var3) {
      if (var1 == null) {
         return !this.d();
      } else {
         for(int var4 = 0; var4 < 6; ++var4) {
            Border var5 = this.c[var4];
            Border var6 = var1.c[var4];
            if (var5.getLineStyle() != var6.getLineStyle()) {
               return false;
            }

            if (var5.getLineStyle() != 0 && var5.a.b(var6.a, var2, var3)) {
               return false;
            }
         }

         return true;
      }
   }

   public void setColor(Color color) {
      for(int var2 = 0; var2 < 6; ++var2) {
         Border var3 = this.c[var2];
         var3.setColor(color);
      }

   }

   public void setStyle(int style) {
      for(int var2 = 0; var2 < 6; ++var2) {
         Border var3 = this.c[var2];
         var3.setLineStyle(style);
      }

   }

   public Color getDiagonalColor() {
      return this.c[2].getLineStyle() == 0 ? this.c[1].getColor() : this.c[2].getColor();
   }

   public void setDiagonalColor(Color value) {
      zakp var2 = new zakp(false);
      if (!com.aspose.cells.a.c.zh.a(value) && value != Color.getBlack()) {
         var2.a(2, value.toArgb());
      } else {
         var2.a(true);
      }

      this.c[1].a = var2;
      this.c[2].a = var2;
   }

   zakp e() {
      return this.c[2].getLineStyle() == 0 ? this.c[1].a : this.c[2].a;
   }

   public int getDiagonalStyle() {
      return this.c[2].getLineStyle() == 0 ? this.c[1].getLineStyle() : this.c[2].getLineStyle();
   }

   public void setDiagonalStyle(int value) {
      this.c[1].setLineStyle(value);
      this.c[2].setLineStyle(value);
   }

   byte f() {
      Border var1 = this.getByBorderType(16);
      Border var2 = this.getByBorderType(32);
      if (var1.getLineStyle() != 0) {
         return (byte)(var2.getLineStyle() != 0 ? 3 : 1);
      } else {
         return (byte)(var2.getLineStyle() != 0 ? 2 : 0);
      }
   }

   void a(BorderCollection var1) {
      int var2;
      for(var2 = 0; var2 < 6; ++var2) {
         Border var3 = var1.c[var2];
         Border var4 = this.c[var2];
         var4.a(var3);
      }

      for(var2 = 6; var2 < 8; ++var2) {
         if (var1.c[var2] != null) {
            this.c[var2] = new Border(this);
            this.c[var2].a(var1.c[var2]);
         }
      }

   }
}
